package com.luo.testtouch;

import android.app.Activity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.text.method.MovementMethod;
import android.util.Log;
import android.view.MotionEvent;

import com.luo.testtouch.publicview.GUitl;
import com.luo.testtouch.publicview.MyFrameLayout;
import com.luo.testtouch.publicview.MyScrollView;
import com.luo.testtouch.publicview.MyTextV;
import com.luo.testtouch.publicview.NoteView;

/**
 * 测试事件传递规律
 * 
 * Activity
 * 
 * viewGroup
 * 
 * view
 * 
 */
public class TouchActivity2 extends Activity
{

	private MyScrollView mScrollV;
	private MyFrameLayout mframeV;
	private MyTextV mTextV;
	private NoteView noteV;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.touch2_layout);
        
        
        mScrollV = (MyScrollView)findViewById(R.id.content_scroll_layout);
        mframeV = (MyFrameLayout)findViewById(R.id.content_frame);
        mTextV = (MyTextV)findViewById(R.id.content);
        noteV = (NoteView)findViewById(R.id.note);
        
        noteV.setPencilColor(GUitl.PENCIL_COLOR);
        
        
        ///1111情况：文本span可点击，scrollV可以滑动
//        noteV.setCanNote(false);
//        mTextV.setCanTouch(true);
//        mScrollV.setScrollable(true);
        
        
        
        ///2222
//        noteV.setCanNote(true);
//        mTextV.setCanTouch(true);
//        mScrollV.setScrollable(true);
        
//        mTextV.setText("text");
//        mTextV.setMovementMethod(LinkMovementMethod.getInstance());
        
        ///333
        noteV.setCanNote(true);
//        mTextV.setCanTouch(true);
        mTextV.setMustTouch(true);
        mScrollV.setScrollable(true);
        
    }

	@Override
	public boolean onTouchEvent(MotionEvent event)
	{
		Log.i(GUitl.Log_TAG, "Activiy --onTouchEvent");
		return super.onTouchEvent(event);
	}

	@Override
	public boolean dispatchTouchEvent(MotionEvent ev)
	{
		Log.i(GUitl.Log_TAG,
				"Activiy --dispatchTouchEvent--action==" + ev.getAction());

		return super.dispatchTouchEvent(ev);
	}

}
